<?php

namespace App\Traits;

trait RequestCache
{
    private static $caches = [];

    function requestCache($key, $call)
    {
        if (isset(self::$caches[$key])) {
            return self::$caches[$key];
        }
        return self::$caches[$key] = $call();
    }
}